package com.ruoyi.project.cardbox.orders.domain;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

@Getter
public enum OrderStatus {
    DRAFT(0, "草稿"),
    REQUESTED(1, "请购"),
    IN_STOCK(2, "入库"),
    OUT_STOCK(3, "出库");

    @EnumValue
    private final int value;

    @JsonValue
    private final String desc;

    OrderStatus(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static OrderStatus fromValue(int value) {
        for (OrderStatus status : values()) {
            if (status.value == value) {
                return status;
            }
        }
        return null;
    }
}

